<extend name="_layout/main" />
<block name="head">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/assets/css/jasny-bootstrap.min.css" />
	<style type="text/css">
		#thumb~i,
		{
			display: none!important;
		}
	</style>
</block>
<block name="content">
	<div class="page-content">
		<div class="page-breadcrumbs">
			<ul class="breadcrumb">
				<li>
					<i class="fa fa-home"></i>
					<a href="{:U('dashboard/index')}">系统首页</a>
				</li>
				<li>
					<a href="javascript:;">文章管理</a>
				</li>
				<li class="active">{$category['name']}</li>
			</ul>
		</div>
		<div class="page-body">
			<div class="row">
				<div class="col-xs-12 col-md-12">
					<div class="widget">
						<div class="widget-header">
							<span class="widget-caption">{$category['name']}</span>
						</div>
						<div class="widget-body">
							<div>
									<form role="form" class="form-horizontal" method="post" id="addForm" action="{:U('article/page_add')}" >
											<input type="hidden" name="id" value="{$id}"  />
												<div class="form-group ">
													<label for="title" class="col-sm-2 control-label no-padding-right">标题</label>
													<div class="col-xs-4">
														<input type="text" class="form-control" id="title" name="title" value="{$title}">
													</div>
												</div>
												<div class="form-group">
													<label for="summary" class="col-sm-2 control-label no-padding-right">内容</label>
													<div class="col-xs-6">
														<?php echo form::editor('content',$content,'full')?>
													</div>
												</div>

											<div class="row">
												<div class="col-sm-offset-2 col-sm-10">
													<button type="submit" class="btn btn-blue ladda-button" data-style="expand-right" id="submitBtn"> <span class="ladda-label">确认保存</span></button>
												</div>
											</div>
									</form>
								</div>

							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</block>

<block name="footer">
	<script src="__PUBLIC__/assets/js/validation/bootstrapValidator.js" type="text/javascript" charset="utf-8"></script>
	<script src="__PUBLIC__/assets/js/select2/select2.js"></script>
	<script src="__PUBLIC__/assets/js/holder.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="__PUBLIC__/assets/js/jasny-bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="__PUBLIC__/assets/js/jquery.form.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">

		var loader = Ladda.create(document.getElementById("submitBtn"));
		$("#addForm").bootstrapValidator({
			excluded: [':disabled'],
			feedbackIcons: {
				valid: 'glyphicon glyphicon-ok',
				invalid: 'glyphicon glyphicon-remove',
				validating: 'glyphicon glyphicon-refresh'
			},
			submitHandler: function(validator, form, submitButton) {
				loader.start();
				$("#addForm").ajaxSubmit(function(result) {
					loader.stop();
					result = JSON.parse(result);
					if (result.status == 'success') {
						location.reload();
					} else {
						tips(result.message, 'danger');
						validator.disableSubmitButtons(false);
					}
				});
			},
			fields: {
				title: {
					validators: {
						notEmpty: {
							message: '文章标题不能为空'
						}
					}
				}
			}
		});
	</script>
</block>